/*
 * Filename:    WarningOrgBlackController.java
 * Copyright:   2014 中国平安保险（集团）股份有限公司 版权所有
 * Company:     平安科技养老险及健康险系统开发部
 * Create at:   2014年11月11日
 */
package com.paic.mhis.hcpms.warning.web.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.paic.mhis.hcpms.warning.biz.service.WarningOrgBlackService;
import com.paic.mhis.hcpms.warning.web.vo.WarningOrgBlackVO;
import com.paic.pafa.app.biz.service.BusinessServiceException;
import com.paic.pafa.appclient.annotation.BizServicesProxy;
import com.paic.pafa.exceptions.BusinessException;

@Controller
@RequestMapping("/warningOrgBlack/")
public class WarningOrgBlackController {
	@BizServicesProxy
	private WarningOrgBlackService warningOrgBlackService;

	@RequestMapping("warningOrg.do")
	@ResponseBody
	public Map<String, Object> warningOrg(@ModelAttribute WarningOrgBlackVO search, HttpServletRequest request)
			throws BusinessServiceException, BusinessException {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("orgCode", StringUtils.isEmpty(search.getOrgCode()) ? null : search.getOrgCode());
		paramMap.put("orgType", StringUtils.isEmpty(search.getOrgType()) ? null : search.getOrgType());
		paramMap.put("orgCategory", StringUtils.isEmpty(search.getOrgCategory()) ? null : search.getOrgCategory());
		paramMap.put("orgLevel", StringUtils.isEmpty(search.getOrgLevel()) ? null : search.getOrgLevel());
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("warningOrg", warningOrgBlackService.findWarningOrg(paramMap));
		return map;
	}

	@RequestMapping("warningMedical.do")
	@ResponseBody
	public Map<String, Object> warningMedical(@ModelAttribute WarningOrgBlackVO search, HttpServletRequest request)
			throws BusinessServiceException, BusinessException {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("name", StringUtils.isEmpty(search.getName()) ? null : search.getName());
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("warningMedical", warningOrgBlackService.findWarningMedical(paramMap));
		return map;
	}

	@RequestMapping("warningBlack.do")
	@ResponseBody
	public Map<String, Object> warningBlack(@ModelAttribute WarningOrgBlackVO search, HttpServletRequest request)
			throws BusinessServiceException, BusinessException {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("name", StringUtils.isEmpty(search.getName()) ? null : search.getName());
		paramMap.put("personType", StringUtils.isEmpty(search.getPersonType()) ? null : search.getPersonType());
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("warningBlack", warningOrgBlackService.findWarningBlack(paramMap));
		return map;
	}
}
